package exploit

import (
	"fmt"
	"github.com/cdk-team/CDK/pkg/tool/kubectl"
	"log"
)


func GetNamespaces(serverAddr string) string {
	log.Println("requesting ", configmapApi)
	resp, err := kubectl.ServerAccountRequest(
		kubectl.K8sRequestOption{
			TokenPath: "",
			Server:    serverAddr, // default
			Api:       "/api/v1/namespaces",
			Method:    "get",
			PostData:  "",
			Anonymous: true,
		})
	if err != nil {
		fmt.Println(err)
	}

	return resp
}

func GetNodes(serverAddr string) string {
	log.Println("requesting ", configmapApi)
	resp, err := kubectl.ServerAccountRequest(
		kubectl.K8sRequestOption{
			TokenPath: "",
			Server:    serverAddr, // default
			Api:       "/api/v1/namespaces",
			Method:    "get",
			PostData:  "",
			Anonymous: true,
		})
	if err != nil {
		fmt.Println(err)
	}

	return resp
}